import request from '@/utils/request';
import type { ServiceItem, UploadFileData } from '@/types/service'
import type { ApiResponse } from '@/utils/request'

/**
 * 获取服务列表
 */
export function getServiceList() {
  return request.get<ApiResponse<{ items: ServiceItem[] }>>('/common/get-service-list')
}

/**
 * 上传文件
 */
export function uploadFile(data: { file: File }) {
  const formData = new FormData()
  formData.append('file', data.file)
  return request.post<ApiResponse<UploadFileData>>('/common/upload', formData, {
    headers: { 'Content-Type': 'multipart/form-data' }
  })
}

/**
 * 查询订单详情
 */
export function getOrderDetailApi(order_no: string) {
  return request.get('/work_order/detail', { params: { order_no } })
}

/**
 * 提交预约订单
 */
export function submitOrderApi(params: { order_no: string, customer: any }) {
  return request.post<ApiResponse<any>>('/customer/submit', params)
}

/**
 * 获取评价标签列表
 */
export function getEvaluateTagsList() {
  return request.get<ApiResponse<{ items: String[] }>>('/customer/get-evaluate-tags-lists')
}
/**
 * 提交评价
 */
export function submitEvaluate(params: { order_no: string, evaluate: any }) {
  return request.post<ApiResponse<any>>('/customer/evaluate', params)
}

